package com.cdtye.itps.cms.service.defect;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cdtye.common.mybatiscore.base.BaseService;
import com.cdtye.common.webcore.web.BizException;
import com.cdtye.itps.cms.dao.defect.entity.JcwDefectInfoPhoto;
import com.cdtye.itps.cms.dao.defect.entity.JcwProblemDefectInfo;
import com.cdtye.itps.cms.dao.defect.vo.JcwProblemDefectInfoVo;
import com.cdtye.itps.cms.dao.enums.JcwDefectPhotoFlagEnum;
import com.cdtye.itps.cms.dao.line.entity.JcSecline;
import com.cdtye.itps.cms.dao.line.vo.JcSeclineVo;
import com.cdtye.itps.cms.dao.result.*;
import com.cdtye.itps.cms.mapper.defect.JcwProblemDefectInfoMapper;
import com.cdtye.itps.cms.mapper.lineSite.JcLineSiteMapper;
import com.cdtye.itps.cms.mapper.plan.JcjcPlanDetailMapper;
import com.cdtye.itps.cms.service.dept.SysDeptService;
import com.cdtye.itps.cms.service.line.JcSeclineService;
import com.cdtye.itps.cms.util.DateUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Service
public class JcwProblemDefectInfoService extends BaseService<JcwProblemDefectInfoMapper, JcwProblemDefectInfo> {

    @Autowired
    private JcwDefectInfoPhotoService jcwDefectInfoPhotoService;

    @Autowired
    private SysDeptService sysDeptService;

    @Autowired
    private JcSeclineService jcSeclineService;

    @Autowired
    private JcwProblemDefectCategoryService jcwProblemDefectCategoryService;

    @Autowired
    private JcjcPlanDetailMapper jcjcPlanDetailMapper;

    @Autowired
    private JcLineSiteMapper jcLineSiteMapper;


    /**
     *缺陷管理-缺陷信息-分页查询
     */
    public IPage<Map<String,Object>> listPage(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        if (vo.getFindEndDate()!=null) {
            String endDate = DateUtils.DateToString(vo.getFindEndDate(),"yyyy-MM-dd")+" 23:59:59";
            vo.setFindEndDate(DateUtils.StringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if (vo.getHandleEndDate()!=null) {
            String endDate = DateUtils.DateToString(vo.getHandleEndDate(),"yyyy-MM-dd")+" 23:59:59";
            vo.setHandleEndDate(DateUtils.StringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        IPage<Map<String, Object>> datas = baseMapper.pageList(vo.page(), vo);
        List<Map<String,Object>> mapList = datas.getRecords();
        if(CollectionUtils.isEmpty(mapList)){
            return datas;
        }
        return datas;
    }


    /**
     * 缺陷管理-缺陷信息-根据缺陷信息id获取缺陷详情
     */
    public Map<String,Object> getDefectInfoById(String id){
        if(null == id){
            throw new BizException("id is null");
        }
        Map<String,Object> map = baseMapper.getDefectInfoById(id);
        if(map == null){
            throw  new BizException("缺陷信息录入有问题，请联系管理员检查数据配置！");

        }
        List<JcwDefectInfoPhoto> jcwDefectInfoPhotoList = jcwDefectInfoPhotoService.getByDefectInfoIdList(Stream.of(id).collect(Collectors.toList()));
        map = this.handleFile(map, jcwDefectInfoPhotoList);
        return map;
    }

    /**
     * 处理缺陷图片
     * @param map
     * @param jcwDefectInfoPhotoList
     * @return
     */
    private  Map<String,Object> handleFile(Map<String,Object> map,List<JcwDefectInfoPhoto> jcwDefectInfoPhotoList){
        if(map == null){
            return null;

        }
        List<JcwDefectInfoPhoto> defectImagesList = new ArrayList<>();
        List<JcwDefectInfoPhoto> retestImagesList = new ArrayList<>();
        List<JcwDefectInfoPhoto> repairImagesList = new ArrayList<>();
        if(CollectionUtils.isEmpty(jcwDefectInfoPhotoList)){
            map.put("defectImagesList",defectImagesList);
            map.put("retestImagesList",retestImagesList);
            map.put("repairImagesList",repairImagesList);
        }else{
            Map<String,List<JcwDefectInfoPhoto>> jcwArchiveListMapTemp  = jcwDefectInfoPhotoList.stream().collect(Collectors.groupingBy(JcwDefectInfoPhoto::getPhotoFlag));
            defectImagesList = jcwArchiveListMapTemp.get(JcwDefectPhotoFlagEnum.RepairBefore.value.toString());

            //将photoFlag为3的图片归属为缺陷图片
            List<JcwDefectInfoPhoto> jcwDefectInfoPhoto6C = jcwArchiveListMapTemp.get(JcwDefectPhotoFlagEnum.Six_C.value.toString());
            if(CollectionUtils.isNotEmpty(defectImagesList) && CollectionUtils.isNotEmpty(jcwDefectInfoPhoto6C)) {
                defectImagesList.addAll(jcwDefectInfoPhoto6C);
            }else if(CollectionUtils.isEmpty(defectImagesList) && CollectionUtils.isNotEmpty(jcwDefectInfoPhoto6C)){
                defectImagesList = jcwDefectInfoPhoto6C;
            }

            retestImagesList = jcwArchiveListMapTemp.get(JcwDefectPhotoFlagEnum.Retest_Image.value.toString());
            repairImagesList = jcwArchiveListMapTemp.get(JcwDefectPhotoFlagEnum.RepairAfter.value.toString());
            map.put("defectImagesList",defectImagesList==null?new ArrayList<>():defectImagesList);
            map.put("retestImagesList",retestImagesList==null?new ArrayList<>():retestImagesList);
            map.put("repairImagesList",repairImagesList==null?new ArrayList<>():repairImagesList);
        }
        return map;

    }

    /**
     *  首页-缺陷基本信息
     */
    public BasicDefectInfoResVo getBasicDefectInfo(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        BasicDefectInfoResVo b = new BasicDefectInfoResVo();
        b.setC1Defect(6901);
        b.setC2Defect(716);
        b.setC3Defect(12374);
        b.setC4Defect(7484);
        b.setC5Defect(0);
        b.setC6Defect(0);
        b.setCanceledNumber(5);
        b.setDefectSum(8);
        b.setOneLevelDefectSum(0);
        b.setProcessedDetects(null);
        b.setProcessingDetects(23010);
        b.setTwoLevelADefectSum(8);
        b.setTwoLevelBDefectSum(0);
        b.setUnCancelledNum(3);
        b.setUnProcessedDetects(null);
        return b;
        //return baseMapper.defectStatisticsIndex(vo);
    }

    /**
     * 首页-缺陷单位分布
     */
    public List<DefectUnitDistributeResVo> getDefectUnitDistribute(JcwProblemDefectInfoVo query){
        List<DefectUnitDistributeResVo> result=new ArrayList<>();
        //数据权限过滤
        query.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<DefectStatisticVo> list = baseMapper.getDefectSectionStatistics(query);
        list.stream().forEach(a->{
            DefectUnitDistributeResVo unitDistributeVo=new DefectUnitDistributeResVo();
            unitDistributeVo.setDeptName(a.getName());
            unitDistributeVo.setDealedNum(a.getDealed());
            unitDistributeVo.setUnDealedNum(a.getUndealed());
            unitDistributeVo.setRate("0");
            unitDistributeVo.setDeptCode(a.getDeptCode());
            if(a.getDealed()!=0 && a.getUndealed()!=0){
                unitDistributeVo.setRate(new BigDecimal(a.getDealed()*100).divide(new BigDecimal(a.getDealed()+a.getUndealed()),2,BigDecimal.ROUND_HALF_UP).toString());
            }
            result.add(unitDistributeVo);
        });
        return result;
    }

    /**
     * 缺陷供电段分布统计-表格
     */
    public List<DefectStatisticVo> getDefectSectionTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo)
    {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectSectionStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        NumberFormat percentFormat = NumberFormat.getPercentInstance();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                if (defectStatisticVo.getTotal() != 0) {
                    defectStatisticVo.setRate(percentFormat.format((double) defectStatisticVo.getDealed() / defectStatisticVo.getTotal()));
                } else {
                    defectStatisticVo.setRate(percentFormat.format(0));
                }
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     * 缺陷供电车间分布统计-表格
     */
    public List<DefectStatisticVo> getDefectWorkShopTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo)
    {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectWorkShopStatistics(jcwProblemDefectInfoVo);
        NumberFormat percentFormat = NumberFormat.getPercentInstance();
        List<DefectStatisticVo> list2 = new ArrayList<>();
        list.forEach(defectStatisticVo -> {
            if(StringUtils.isNotBlank(defectStatisticVo.getName())){
                if (defectStatisticVo.getTotal() != 0) {
                    defectStatisticVo.setRate(percentFormat.format((double) defectStatisticVo.getDealed() / defectStatisticVo.getTotal()));
                } else {
                    defectStatisticVo.setRate(percentFormat.format(0));
                }
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     * 缺陷供电车间分布统计-表格
     */
    public Map<String,Object> getDefectSection(){
        JcwProblemDefectInfoVo jcwProblemDefectInfoVo = new JcwProblemDefectInfoVo();
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<DefectStatisticVo> list = baseMapper.getDefectSectionStatistics(jcwProblemDefectInfoVo);
        Map<String,Object> map = new HashMap<>();
        List<String> depts = new ArrayList<>();
        List<Integer> total = new ArrayList<>();
        List<Integer> dealed = new ArrayList<>();
        List<Integer> undealed = new ArrayList<>();
        List<Integer> rate = new ArrayList<>();
        list.forEach(item -> {
            depts.add(item.getName());
            total.add(item.getTotal());
            dealed.add(item.getDealed());
            undealed.add(item.getUndealed());
            rate.add(new Double((double)item.getDealed()/item.getTotal()*100).intValue());
        });
        map.put("depts",depts);
        map.put("total",total);
        map.put("dealed",dealed);
        map.put("undealed",undealed);
        map.put("rate",rate);
        return map;
    }

    /**
     * 缺陷供电段季度分布统计-表格
     */
    public List<DefectStatisticVo> getDefectSectionQuarterTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo){
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectSectionQuarterStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     *缺陷供电车间季度分布统计-表格
     */
    public List<DefectStatisticVo> getDefectWorkShopQuarterTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo){
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectWorkShopQuarterStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     * 缺陷线路季度分布统计-表格
     */
    public List<DefectStatisticVo> getDefectLineQuarterTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo){
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectLineQuarterStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }


    /**
     * 缺陷供电段月份分布统计-表格
     */
    public List<DefectStatisticVo> getDefectSectionMonthTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo){
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectSectionMonthStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     * 缺陷供电车间月份分布统计-表格
     */
    public List<DefectStatisticVo> getDefectWorkShopMonthTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo){
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectWorkShopMonthStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     * 缺陷线路月份分布统计-表格
     */
    public List<DefectStatisticVo> getDefectLineMonthTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo){
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectLineMonthStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     * 缺陷部位分布统计-表格
     */
    public List<DefectStatisticVo> getDefectPositionTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo)
    {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list= baseMapper.getDefectPositionStatistic(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        NumberFormat percentFormat = NumberFormat.getPercentInstance();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                if (defectStatisticVo.getTotal() != 0) {
                    defectStatisticVo.setRate(percentFormat.format((double) defectStatisticVo.getDealed() / defectStatisticVo.getTotal()));
                } else {
                    defectStatisticVo.setRate(percentFormat.format(0));
                }
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     * 缺陷线路分布统计-表格
     */
    public List<DefectStatisticVo> getDefectLineTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectLineStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        NumberFormat percentFormat = NumberFormat.getPercentInstance();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                if (defectStatisticVo.getTotal() != 0) {
                    defectStatisticVo.setRate(percentFormat.format((double) defectStatisticVo.getDealed() / defectStatisticVo.getTotal()));
                } else {
                    defectStatisticVo.setRate(percentFormat.format(0));
                }
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }


    /**
     * 缺陷站分布统计-表格
     */
    public List<DefectStatisticVo> getDefectSiteTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list= baseMapper.getDefectSiteStatistics(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        NumberFormat percentFormat = NumberFormat.getPercentInstance();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                if (defectStatisticVo.getTotal() != 0) {
                    defectStatisticVo.setRate(percentFormat.format((double) defectStatisticVo.getDealed() / defectStatisticVo.getTotal()));
                } else {
                    defectStatisticVo.setRate(percentFormat.format(0));
                }
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }


    /**
     * 缺陷类型分布统计-表格
     */
    public List<DefectStatisticVo> getDefectTypeTable(JcwProblemDefectInfoVo jcwProblemDefectInfoVo)
    {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(jcwProblemDefectInfoVo.getDeptCode()));
        List<DefectStatisticVo> list= baseMapper.getDefectTypeStatistic(jcwProblemDefectInfoVo);
        List<DefectStatisticVo> list2 = new ArrayList<>();
        NumberFormat percentFormat = NumberFormat.getPercentInstance();
        list.forEach(defectStatisticVo -> {
            if(null!=defectStatisticVo.getName()){
                if (defectStatisticVo.getTotal() != 0) {
                    defectStatisticVo.setRate(percentFormat.format((double) defectStatisticVo.getDealed() / defectStatisticVo.getTotal()));
                } else {
                    defectStatisticVo.setRate(percentFormat.format(0));
                }
                list2.add(defectStatisticVo);
            }
        });
        return list2;
    }

    /**
     *首页-超期预警情况-缺陷
     */
    public Map<String,Object> getDefectOverWarn(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        return baseMapper.getDefectOverWarn(vo);
    }

    /**
     * 首页-缺陷基础信息-缺陷类型分布TOP10
     */
    public Map<String,Object> getDefectTypeTop10(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<Map<String,Object>> mapDataList = baseMapper.getDefectTypeTop10(jcwProblemDefectInfoVo);
        Integer totalNum = 0;
        for (int i = 0; i < mapDataList.size(); i++) {
            if(mapDataList.get(i).get("value")!=null){
                totalNum = totalNum + Integer.valueOf(mapDataList.get(i).get("value").toString());
            }
        }
        DecimalFormat df = new DecimalFormat("0.00");
        for (int i = 0; i < mapDataList.size(); i++) {
            if(mapDataList.get(i).get("value")!=null){
                Double tagNum = Double.valueOf(mapDataList.get(i).get("value").toString());
                mapDataList.get(i).put("proportion",df.format(tagNum*100/totalNum)+"%");
            }
        }
        Map<String,Object> result = new HashMap<>();
        result.put("total",totalNum);
        result.put("data",mapDataList);
        return result;
    }

    /**
     * 首页-缺陷基础信息-缺陷6C类型分布
     */
    public List<Map<String,Object>> getDefectType_6C(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<Map<String,Object>> mapDataList = baseMapper.getDefectType_6C(jcwProblemDefectInfoVo);
        Integer totalNum = 0;
        for (int i = 0; i < mapDataList.size(); i++) {
            if(mapDataList.get(i).get("value")!=null){
                totalNum = totalNum + Integer.valueOf(mapDataList.get(i).get("value").toString());
            }
        }
        DecimalFormat df = new DecimalFormat("0.00");
        for (int i = 0; i < mapDataList.size(); i++) {
            if(mapDataList.get(i).get("value")!=null){
                Double tagNum = Double.valueOf(mapDataList.get(i).get("value").toString());
                mapDataList.get(i).put("proportion",df.format(tagNum*100/totalNum)+"%");
            }
        }
        return mapDataList;
    }

    /**
     * 首页-缺陷基础信息-缺陷设备分布TOP5
     */
    public List<Map<String,Object>> getDefectDeviceTop5(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        return baseMapper.getDefectDeviceTop5(jcwProblemDefectInfoVo);
    }

    /**
     * 首页-缺陷基础信息-缺陷分布
     */
    public Map<String,Object> getDefect(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<Map<String,Object>> mapDataList = baseMapper.getDefect(jcwProblemDefectInfoVo);
        List<String> xData = new ArrayList<>();
        List<Integer> data = new ArrayList<>();
        for (int i = 0; i < mapDataList.size(); i++) {
            xData.add(mapDataList.get(i).get("name").toString());
            data.add(Integer.valueOf(mapDataList.get(i).get("value").toString()));
        }
        Map result = new HashMap();
        result.put("xData",xData);
        result.put("data",data);
        return result;
    }

    /**
     * 首页-缺陷单位分布-缺陷周期修
     */
    public List<Map<String,Object>> getDefectCycle(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<Map<String,Object>> mapDataList = baseMapper.getDefectCycle(jcwProblemDefectInfoVo);
        // 计算增幅
        Integer totalnum_1 = Integer.valueOf(mapDataList.get(0).get("totalnum").toString());
        Integer totalnum_2 = Integer.valueOf(mapDataList.get(1).get("totalnum").toString());
        Integer totalnum_3 = Integer.valueOf(mapDataList.get(2).get("totalnum").toString());
        Integer totalnum_4 = Integer.valueOf(mapDataList.get(3).get("totalnum").toString());
        Integer totalnum_5 = Integer.valueOf(mapDataList.get(4).get("totalnum").toString());
        Integer totalnum_6 = Integer.valueOf(mapDataList.get(5).get("totalnum").toString());
        Integer totalnum_7 = Integer.valueOf(mapDataList.get(6).get("totalnum").toString());
        Integer totalnum_8 = Integer.valueOf(mapDataList.get(7).get("totalnum").toString());
        Integer totalnum_9 = Integer.valueOf(mapDataList.get(8).get("totalnum").toString());
        Integer totalnum_10 = Integer.valueOf(mapDataList.get(9).get("totalnum").toString());
        Integer totalnum_11 = Integer.valueOf(mapDataList.get(10).get("totalnum").toString());
        Integer totalnum_12 = Integer.valueOf(mapDataList.get(11).get("totalnum").toString());
        DecimalFormat df = new DecimalFormat("0.00");
        if(totalnum_1==0 || totalnum_2==0){
            mapDataList.get(1).put("increaseRate","0%");
        }else{
            mapDataList.get(1).put("increaseRate",df.format(Double.valueOf(totalnum_2-totalnum_1)*100/totalnum_1)+"%");
        }
        if(totalnum_2==0 || totalnum_3==0){
            mapDataList.get(2).put("increaseRate","0%");
        }else{
            mapDataList.get(2).put("increaseRate",df.format(Double.valueOf(totalnum_3-totalnum_2)*100/totalnum_2)+"%");
        }
        if(totalnum_3==0 || totalnum_4==0){
            mapDataList.get(3).put("increaseRate","0%");
        }else{
            mapDataList.get(3).put("increaseRate",df.format(Double.valueOf(totalnum_4-totalnum_3)*100/totalnum_3)+"%");
        }
        if(totalnum_4==0 || totalnum_5==0){
            mapDataList.get(4).put("increaseRate","0%");
        }else{
            mapDataList.get(4).put("increaseRate",df.format(Double.valueOf(totalnum_5-totalnum_4)*100/totalnum_4)+"%");
        }
        if(totalnum_5==0 || totalnum_6==0){
            mapDataList.get(5).put("increaseRate","0%");
        }else{
            mapDataList.get(5).put("increaseRate",df.format(Double.valueOf(totalnum_6-totalnum_5)*100/totalnum_5)+"%");
        }
        if(totalnum_6==0 || totalnum_7==0){
            mapDataList.get(6).put("increaseRate","0%");
        }else{
            mapDataList.get(6).put("increaseRate",df.format(Double.valueOf(totalnum_7-totalnum_6)*100/totalnum_6)+"%");
        }
        if(totalnum_7==0 || totalnum_8==0){
            mapDataList.get(7).put("increaseRate","0%");
        }else{
            mapDataList.get(7).put("increaseRate",df.format(Double.valueOf(totalnum_8-totalnum_7)*100/totalnum_7)+"%");
        }
        if(totalnum_8==0 || totalnum_9==0){
            mapDataList.get(8).put("increaseRate","0%");
        }else{
            mapDataList.get(8).put("increaseRate",df.format(Double.valueOf(totalnum_9-totalnum_8)*100/totalnum_8)+"%");
        }
        if(totalnum_9==0 || totalnum_10==0){
            mapDataList.get(9).put("increaseRate","0%");
        }else{
            mapDataList.get(9).put("increaseRate",df.format(Double.valueOf(totalnum_10-totalnum_9)*100/totalnum_9)+"%");
        }
        if(totalnum_10==0 || totalnum_11==0){
            mapDataList.get(10).put("increaseRate","0%");
        }else{
            mapDataList.get(10).put("increaseRate",df.format(Double.valueOf(totalnum_11-totalnum_10)*100/totalnum_10)+"%");
        }
        if(totalnum_11==0 || totalnum_12==0){
            mapDataList.get(11).put("increaseRate","0%");
        }else{
            mapDataList.get(11).put("increaseRate",df.format(Double.valueOf(totalnum_12-totalnum_11)*100/totalnum_11)+"%");
        }
        // 计算总数
        Integer totalTotalNum = totalnum_1 + totalnum_2 +totalnum_3+totalnum_4+totalnum_5+totalnum_6+totalnum_7+totalnum_8+totalnum_9+totalnum_10+totalnum_11+totalnum_12;
        Integer noDealNum_1 = Integer.valueOf(mapDataList.get(0).get("nodealnum").toString());
        Integer noDealNum_2 = Integer.valueOf(mapDataList.get(1).get("nodealnum").toString());
        Integer noDealNum_3 = Integer.valueOf(mapDataList.get(2).get("nodealnum").toString());
        Integer noDealNum_4 = Integer.valueOf(mapDataList.get(3).get("nodealnum").toString());
        Integer noDealNum_5 = Integer.valueOf(mapDataList.get(4).get("nodealnum").toString());
        Integer noDealNum_6 = Integer.valueOf(mapDataList.get(5).get("nodealnum").toString());
        Integer noDealNum_7 = Integer.valueOf(mapDataList.get(6).get("nodealnum").toString());
        Integer noDealNum_8 = Integer.valueOf(mapDataList.get(7).get("nodealnum").toString());
        Integer noDealNum_9 = Integer.valueOf(mapDataList.get(8).get("nodealnum").toString());
        Integer noDealNum_10 = Integer.valueOf(mapDataList.get(9).get("nodealnum").toString());
        Integer noDealNum_11 = Integer.valueOf(mapDataList.get(10).get("nodealnum").toString());
        Integer noDealNum_12 = Integer.valueOf(mapDataList.get(11).get("nodealnum").toString());
        Integer noDealTotalNum = noDealNum_1 + noDealNum_2 +noDealNum_3+noDealNum_4+noDealNum_5+noDealNum_6+noDealNum_7+noDealNum_8+noDealNum_9+noDealNum_10+noDealNum_11+noDealNum_12;
        Map<String,Object> mapTotal = new HashMap<>();
        mapTotal.put("noDealTotalNum",noDealTotalNum);
        mapTotal.put("totalTotalNum",totalTotalNum);
        mapDataList.add(mapTotal);
        return mapDataList;
    }

    /**
     * 首页-缺陷单位分布-未处理缺陷类型分布
     */
    public Map<String,Object> getUntreatedDefectType(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<Map<String,Object>> mapDataList = baseMapper.getUntreatedDefectType(jcwProblemDefectInfoVo);

        Integer totalNum = 0;
        for (int i = 0; i < mapDataList.size(); i++) {
            if(mapDataList.get(i).get("value")!=null){
                totalNum = totalNum + Integer.valueOf(mapDataList.get(i).get("value").toString());
            }
        }
        DecimalFormat df = new DecimalFormat("0.00");
        for (int i = 0; i < mapDataList.size(); i++) {
            if(mapDataList.get(i).get("value")!=null){
                Double tagNum = Double.valueOf(mapDataList.get(i).get("value").toString());
                mapDataList.get(i).put("proportion",df.format(tagNum*100/totalNum)+"%");
            }
        }
        Map<String,Object> result = new HashMap<>();
        result.put("total",totalNum);
        result.put("data",mapDataList);
        return result;
    }

    /**
     * 首页-缺陷单位分布-未处理缺陷分布
     */
    public Map<String,Object> getUntreatedDefect(JcwProblemDefectInfoVo jcwProblemDefectInfoVo) {
        jcwProblemDefectInfoVo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(null));
        List<Map<String,Object>> mapDataList = baseMapper.getUntreatedDefect(jcwProblemDefectInfoVo);
        List<String> xData = new ArrayList<>();
        List<Integer> data = new ArrayList<>();
        for (int i = 0; i < mapDataList.size(); i++) {
            xData.add(mapDataList.get(i).get("name").toString());
            data.add(Integer.valueOf(mapDataList.get(i).get("value").toString()));
        }
        Map result = new HashMap();
        result.put("xData",xData);
        result.put("data",data);
        return result;
    }

    /**
     *缺陷管理-缺陷信息-统计缺陷总数/未销号/已销号/超期未处理的个数
     */
    public Map<String,Object> getCount(JcwProblemDefectInfoVo vo){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("total",0);
        resultMap.put("notReformCount",0);
        resultMap.put("reformCount",0);
        resultMap.put("overDateCount",0);
        resultMap.put("dangerDateCount",0);
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        Map<String,Object> map = baseMapper.countData(vo);
        return map;
    }

    /**
     *综合分析首页-缺陷单位分布
     */
    public Map<String,List<Object>> getDefectSectionStatistics(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectSectionStatistics(vo);
        List<Object> sectionNameList = new ArrayList<>();
        List<Object> oneLevelNumList = new ArrayList<>();
        List<Object> twoLevelNumList = new ArrayList<>();
        List<Object> undealedList = new ArrayList<>();
        List<Object> totalList = new ArrayList<>();
        List<Object> rateList = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("0.00");
        list.forEach(item->{
            sectionNameList.add(item.getName());
            oneLevelNumList.add(item.getOneLevelNum());
            twoLevelNumList.add(item.getTwoLevelNum());
            totalList.add(item.getTotal());
            undealedList.add(item.getUndealed());
            if(item.getTotal()!=0){
                rateList.add(df.format(item.getDealed()*100/item.getTotal()));
            }
        });
        Map<String,List<Object>> result = new HashMap<>();
        result.put("sectionNameList",sectionNameList);
        result.put("oneLevelNumList",oneLevelNumList);
        result.put("twoLevelNumList",twoLevelNumList);
        result.put("totalList",totalList);
        result.put("undealedList",undealedList);
        result.put("rateList",rateList);
        return result;
    }

    /**
     *综合分析首页-缺陷线路分布
     */
    public Map<String,List<Object>> getDefectLineStatistics(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        List<DefectStatisticVo> list = baseMapper.getDefectLineStatistics(vo);
        List<Object> lineNameList = new ArrayList<>();
        List<Object> oneLevelNumList = new ArrayList<>();
        List<Object> twoLevelNumList = new ArrayList<>();
        List<Object> undealedList = new ArrayList<>();
        List<Object> totalList = new ArrayList<>();
        List<Object> rateList = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("0.00");
        list.forEach(item->{
            lineNameList.add(item.getName());
            oneLevelNumList.add(item.getOneLevelNum());
            twoLevelNumList.add(item.getTwoLevelNum());
            totalList.add(item.getTotal());
            undealedList.add(item.getUndealed());
            if(item.getTotal()!=0){
                rateList.add(df.format(item.getDealed()*100/item.getTotal()));
            }
        });
        Map<String,List<Object>> result = new HashMap<>();
        result.put("sectionNameList",lineNameList);
        result.put("oneLevelNumList",oneLevelNumList);
        result.put("twoLevelNumList",twoLevelNumList);
        result.put("totalList",totalList);
        result.put("undealedList",undealedList);
        result.put("rateList",rateList);
        return result;
    }

    /**
     * 缺陷趋势分析-缺陷信息-按6c统计每月的数据
     */
    public Map<String,Object> defectAndTimeRelation(JcwProblemDefectInfoVo vo){
        Map<String,Object> result = new HashMap<>();
        //total
        List<Map<String,Object>> count = baseMapper.defectAndTimeRelation(vo);
        //1c
        vo.setCType("1C");
        List<Map<String,Object>> C1 = baseMapper.defectAndTimeRelationByCType(vo);
        //2C
        vo.setCType("2C");
        List<Map<String,Object>> C2 = baseMapper.defectAndTimeRelationByCType(vo);
        //3C
        vo.setCType("3C");
        List<Map<String,Object>> C3 = baseMapper.defectAndTimeRelationByCType(vo);
        //4C
        vo.setCType("4C");
        List<Map<String,Object>> C4 = baseMapper.defectAndTimeRelationByCType(vo);
        result.put("count",count);
        result.put("1C",C1);
        result.put("2C",C2);
        result.put("3C",C3);
        result.put("4C",C4);
        return result;
    }

    /**
     *缺陷多发支柱专项分析-缺陷多方支柱top30
     */
    public List<Map<String,Object>> getDefectPillarTop30(JcwProblemDefectInfoVo query) {
        query.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(query.getUnitDeptCode()));
        if (query.getFindEndDate()!=null) {
            String endDate = DateUtils.DateToString(query.getFindEndDate(),"yyyy-MM-dd")+" 23:59:59";
            query.setFindEndDate(DateUtils.StringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        return baseMapper.getDefectPillarTop30(query);
    }

    /**
     *缺陷多发支柱专项分析-缺陷详情
     */
    public List<JcwProblemDefectInfo> getDefectPillarDetail(JcwProblemDefectInfoVo query) {
        query.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(query.getUnitDeptCode()));
        if (query.getFindEndDate()!=null) {
            String endDate = DateUtils.DateToString(query.getFindEndDate(),"yyyy-MM-dd")+" 23:59:59";
            query.setFindEndDate(DateUtils.StringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        return baseMapper.getDefectPillarDetail(query);
    }

    /**
     *缺陷多发支柱专项分析-缺陷类型分布
     */
    public List<Map> getDefectTypeEchart(JcwProblemDefectInfoVo query) {
        query.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(query.getUnitDeptCode()));
        if (query.getFindEndDate()!=null) {
            String endDate = DateUtils.DateToString(query.getFindEndDate(),"yyyy-MM-dd")+" 23:59:59";
            query.setFindEndDate(DateUtils.StringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        return baseMapper.getDefectTypeEchart(query);
    }


    /**
     *缺陷多发支柱专项分析-缺陷等级分布
     */
    public List<Map> getDefectLevelEchart(JcwProblemDefectInfoVo query) {
        query.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(query.getUnitDeptCode()));
        if (query.getFindEndDate()!=null) {
            String endDate = DateUtils.DateToString(query.getFindEndDate(),"yyyy-MM-dd")+" 23:59:59";
            query.setFindEndDate(DateUtils.StringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        return baseMapper.getDefectLevelEchart(query);
    }

    /**
     *缺陷多发支柱专项分析-6C类型缺陷分布
     */
    public List<Map> getDefectEchart(JcwProblemDefectInfoVo query) {
        query.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(query.getUnitDeptCode()));
        return baseMapper.getDefectEchart(query);
    }

    /**
     *根据支柱号获取缺陷信息
     */
    public IPage<Map<String,Object>> getDefectInfoByPillarId(JcwProblemDefectInfoVo vo){
        return baseMapper.getDefectInfoByPillarId(vo.page(),vo);
    }

    /**
     * 缺陷月度数据
     * @return
     */
    public Map<String,Integer[]> defectsSpecialAnalysis(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        Map<String,Integer[]> map = new HashMap<>();
        vo.getYearList().forEach(item->{
            Integer[] monthValueList = new Integer[12];
            Arrays.fill(monthValueList,0);
            map.put(item,monthValueList);
        });
        if (vo.getDefectCategoryId().contains(",")){
            vo.setDefectCategoryIdList(Arrays.asList(vo.getDefectCategoryId().split(",")));
            vo.setDefectCategoryId("");
        }
        List<Map> list = baseMapper.defectsSpecialAnalysis(vo);
        list.forEach(item->{
            String year = item.get("time").toString().substring(0,4);
            Integer monthIndex = Integer.valueOf(item.get("time").toString().substring(5))-1;
            Integer[] temp = map.get(year);
            temp[monthIndex] = Integer.valueOf(item.get("num").toString());
            map.replace(year,temp);
        });
        return map;
    }

    /**
     * 区站缺陷发生排行榜
     * @return
     */
    public Map<String,List<String>> siteDefectTop(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        Map<String,String[]> map = new HashMap<>();
        if (vo.getDefectCategoryId().contains(",")){
            vo.setDefectCategoryIdList(Arrays.asList(vo.getDefectCategoryId().split(",")));
            vo.setDefectCategoryId("");
        }
        List<Map> siteList = baseMapper.siteDefectTop(vo);
        List<String> siteIdList = new ArrayList<>();
        List<String> siteNameList = new ArrayList<>();
        siteList.forEach(site->{
            siteIdList.add(site.get("id").toString());
            siteNameList.add(site.get("name").toString());
        });
        vo.setSiteIdList(siteIdList);

        vo.getYearList().forEach(year->{
            String[] yearList = new String[siteNameList.size()];
            Arrays.fill(yearList,"0");
            map.put(year,yearList);
        });

        List<Map> list = baseMapper.siteDefectYear(vo);

        list.forEach(item->{
            Integer vIndex = siteNameList.indexOf(item.get("name").toString());
            String year = item.get("time").toString();
            String[] temp = map.get(year);
            temp[vIndex] = item.get("num").toString();
            map.replace(year,temp);
        });
        Map<String,List<String>> result = new HashMap<>();
        result.put("siteName",siteNameList);
        vo.getYearList().forEach(item->{
            result.put(item,Arrays.asList(map.get(item)));
        });
        return result;
    }

    /**
     * 缺陷线路年度数据
     * @return
     */
    public Map<String,Integer[]> lineDefectYear(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        //根据unitDeptCode获取供电段管理的线路
        JcSeclineVo seclineVo = new JcSeclineVo();
        vo.setUnitDeptCode(vo.getUnitDeptCode());
        List<JcSecline> lineList = jcSeclineService.getSeclineList(seclineVo);
        Map<String,Integer[]> result = new HashMap<>();
        List<String> lineIdList = new ArrayList<>();
        lineList.forEach(line->{
            Integer[] yearValueList = new Integer[vo.getYearList().size()];
            Arrays.fill(yearValueList,0);
            result.put(line.getSeclineName(),yearValueList);
            lineIdList.add(line.getSeclineId());
        });
        vo.setLineIdList(lineIdList);
        if (vo.getDefectCategoryId().contains(",")){
            vo.setDefectCategoryIdList(Arrays.asList(vo.getDefectCategoryId().split(",")));
            vo.setDefectCategoryId("");
        }
        List<Map> list = baseMapper.defectLineYearAnalyse(vo);
        list.forEach(item->{
            String lineName = item.get("name").toString();
            Integer vIndex = vo.getYearList().indexOf(item.get("time").toString());
            Integer[] temp = result.get(lineName);
            temp[vIndex] = Integer.valueOf(item.get("num").toString());
            result.replace(lineName,temp);
        });
        return result;

    }

    /**
     * 缺陷与年限相关性分析-缺陷年度走势
     */
    public Map<String,List<Integer>> defectYearTrend(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        List<Map<String,Object>> typeList = this.getDefectType(vo);
        vo.setDefectCategoryIdList(typeList.stream().map(m->{ return m.get("id").toString();
        }).collect(Collectors.toList()));
        List<Map<String,Object>> list = baseMapper.defectTypeYearAnalyse(vo);

        Map<String,Integer[]> valueResult = new HashMap<>();

        typeList.forEach(item->{
            Integer[] yearList = new Integer[vo.getYearList().size()];
            Arrays.fill(yearList,0);
            valueResult.put(item.get("name").toString(),yearList);
        });

        list.forEach(item->{
            Integer vIndex = null;
            vIndex = vo.getYearList().indexOf(item.get("time").toString());
            Integer[] temp = valueResult.get(item.get("name").toString());
            temp[vIndex] = Integer.valueOf(item.get("num").toString());
            valueResult.replace(item.get("name").toString(),temp);
        });

        Map<String,List<Integer>> result = new HashMap<>();
        typeList.forEach(item->{
            result.put(item.get("name").toString(),Arrays.asList(valueResult.get(item.get("name").toString())));
        });
        return result;
    }

    /**
     *缺陷与年限相关性分析-缺陷年份堆积
     */
    public Map<String,List<Object>> defectYearHead(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        List<Map<String,Object>> typeList = this.getDefectType(vo);
        vo.setDefectCategoryIdList(typeList.stream().map(m->{ return m.get("id").toString();
        }).collect(Collectors.toList()));

        List<Map<String,Object>> list = baseMapper.defectTypeYearAnalyse(vo);

        Map<String,Object[]> valueResult = new HashMap<>();
        //缺陷类型名称列表
        List<Object> typeName = new ArrayList<>();
        //年份数据列表
        vo.getYearList().forEach(item->{
            Object[] yearList = new Object[typeList.size()];
            Arrays.fill(yearList,0);
            valueResult.put(item,yearList);
        });
        //填充值
        list.forEach(item->{
            Integer vIndex = null;
            if(typeName.contains(item.get("name").toString())){
                vIndex = typeName.indexOf(item.get("name").toString());
            }else{
                typeName.add(item.get("name").toString());
                vIndex = typeName.indexOf(item.get("name").toString());
            }
            valueResult.get(item.get("time").toString())[vIndex] = item.get("num");
        });

        Map<String,List<Object>> result = new HashMap<>();
        result.put("typeName",typeName);
        vo.getYearList().forEach(item->{
            result.put(item,Arrays.asList(valueResult.get(item)));
        });
        return result;
    }

    /**
     * 缺陷与年限相关性分析-缺陷类型年度百分比
     */
    public List<Map> defectTypePercent(JcwProblemDefectInfoVo vo){
        vo.setUnitDeptCode(sysDeptService.getUnitDeptCodeByLoginUser(vo.getUnitDeptCode()));
        List<Map<String,Object>> typeList = this.getDefectType(vo);
        vo.setDefectCategoryIdList(typeList.stream().map(m->{ return m.get("id").toString();}).collect(Collectors.toList()));
        List<Map> result = baseMapper.defectTypePercent(vo);
        return result;
    }



    /**
     * 获取占比的缺陷类型
     */
    private List<Map<String,Object>> getDefectType(JcwProblemDefectInfoVo vo){
        List<Map<String,Object>> typeList = null;
        if(vo.getDefectCategoryIdList() == null || vo.getDefectCategoryIdList().size()<=0){
            typeList = baseMapper.getDefectTypeNameTop10(vo);
        }else{
            typeList = jcwProblemDefectCategoryService.getDefectCategoryListByIdList(vo.getDefectCategoryIdList());
        }
        return typeList;
    }

    /**
     *分页查询 -用于局级同步到段级
     */
    public IPage<JcwProblemDefectInfo> listPageJdgm(JcwProblemDefectInfoVo vo){
        return baseMapper.listPageJdgm(vo.page(), vo);
    }

}
